package com.bringway.p2p.controller;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.bringway.framework.controller.JsonController;
import com.bringway.framework.domain.TreeNode;
import com.bringway.framework.util.RequestUtils;
import com.bringway.p2p.service.DemoService;

import net.sf.json.JSONObject;

@Controller
@RequestMapping("/NewMain")
public class DemoController extends JsonController {
	
	@Autowired
	private DemoService demoService;
	
	
	/**
	 * @作者 lk  
	 * @方法名 queryDemoList  
	 * @功能 TODO 主页菜单显示
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/queryDemoList")
	public ModelAndView queryDemoList(HttpServletRequest request,HttpServletResponse response) throws Exception{
		String nodeId = RequestUtils.getStringParameter(request, "nodeId");
		JSONObject params = new JSONObject();
		if (StringUtils.isEmpty(nodeId)) {
			nodeId="-1";
		}
		List<Map<String, Object>> list = demoService.queryDemoList(nodeId);
		serialize(request, response, list);
		return null;
	}
}
